<admintpl file="header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
<!--        <li><a href="{:U('Luckrate/index',array('giftid'=>$data['giftid']))}">列表</a></li>-->
        <li class="active"><a>编辑</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form" action="{:U('Luckrate/edit_post')}">
        <input type="hidden" name="id" value="{$data['id']}">
        <input type="hidden" name="giftid" value="{$giftid}">
        <fieldset>
            <!--                <div class="control-group">-->
            <!--					<label class="control-label">数量</label>-->
            <!--					<div class="controls">-->
            <!--                        <select name="nums">-->
            <!--                            <volist name="numslist" id="v">-->
            <!--                            <option value="{$v}" <if condition="$data['nums'] eq $v">selected</if>>{$v}</option>-->
            <!--                            </volist>-->
            <!--                        </select>-->
            <!--						<span class="form-required"></span>-->
            <!--					</div>-->
            <!--				</div>-->

            <!--                <div class="control-group">-->
            <!--					<label class="control-label">倍数</label>-->
            <!--					<div class="controls">-->
            <!--						<input type="text" name="times"  value="{$data['times']}"> -->
            <!--						<span class="form-required"></span>-->
            <!--					</div>-->
            <!--				</div>-->

            <div class="control-group">
                <label class="control-label">是否全站</label>
                <div class="controls">
                    <label class="radio inline" for="type_0"><input type="radio" name="isall" value="0" id="type_0"
                        <if condition="$data['isall'] eq 0">checked</if>
                        >否</label>
                    <label class="radio inline" for="type_1"><input type="radio" name="isall" value="1" id="type_1"
                        <if condition="$data['isall'] eq 1">checked</if>
                        >是</label>
                    <span class="form-required">*</span>
                </div>
            </div>

            <!--                <div class="control-group">-->
            <!--					<label class="control-label">中奖概率</label>-->
            <!--					<div class="controls">-->
            <!--						<input type="text" name="rate"  value="{$data['rate']}">%  最小支持0.001%-->
            <!--						<span class="form-required"></span>-->
            <!--					</div>-->
            <!--				</div>-->

            <div class="control-group">
                <label class="control-label">幸运周期</label>
                <div class="controls">
                    <input type="text" name="cycle" value="{$data['cycle']}">
                </div>
            </div>

            <div class="control-group">
                <label class="control-label">返现比例</label>
                <div class="controls">
                    平台：<input type="text" name="platform_ratio" value="{$data['platform_ratio']}"> 主播：<input type="text" name="host_ratio"
                                                                                    value="{$data['host_ratio']}"> 奖池：<input type="text"
                                                                                                        name="reward_ratio"
                                                                                                        value="{$data['reward_ratio']}">（平台、主播比例分成为奖池剩余额度）
                </div>
            </div>

            <div class="control-group">
                <label class="control-label">倍数、个数</label>
                <div class="controls" id="beishu">
						<span>
                            <a class="btn" onclick="addLine();">+</a><br/>
                            <?php
                            foreach(json_decode($data['prize']) as $ary){?>
							<input type="text" name="beishu[]" value="<?php echo $ary[0];?>"><input type="text" name="geshu[]" value="<?php echo $ary[1];?>"><br/>
                            <?php }?>
						</span>
                </div>
            </div>


        </fieldset>
        <div class="form-actions">
            <button type="submit" class="btn btn-primary js-ajax-submit">{:L('EDIT')}</button>
            <a class="btn" href="{:U('Gift/index',array('giftid'=>$data['giftid']))}">{:L('BACK')}</a>
        </div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script>
    function addLine() {
        var html = '<br/><span>\n' +
            '\t\t\t\t\t\t\t<input type="text" name="beishu[]"  value=""><input type="text" name="geshu[]"  value=""><a class="btn" onclick="delLine(this);">-</a>\n' +
            '\t\t\t\t\t\t</span>';
        $("#beishu").append(html);
    }

    function delLine(obj) {
        $($(obj).parent()).remove();
    }
</script>
</body>
</html>
